Skip to content

Instantly share code, notes, and snippets.

@dkorobtsov
dkorobtsov / Add_WindowsDefender_Exclusions.ps1
Last active June 2, 2024 01:38
PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
# PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
#
# For context please read this thread:
# https://github.com/microsoft/WSL/issues/8995
#
# How to use?
# - Save the Script: Open a text editor like Notepad and paste the PowerShell script into it.
# - Save the file with a .ps1 extension, for example, Add_WindowsDefender_Exclusions.ps1.
# - Run PowerShell as Administrator: Search for "PowerShell" in the Start menu, right-click on it, and choose "Run as administrator".
# - Navigate to the Script's Location: Use the cd command to navigate to the directory where you saved the .ps1 file.
@CodeByAidan
CodeByAidan / valgrind-helper.sh
Last active June 2, 2024 01:38
A nice shell script I made for Debian that runs Valgrind, with customizable log file, pretty easy! Try `gcc -o temp -std=c2x -Wall -Og temp.c && ./valgrind-helper.sh temp`
#!/bin/bash
# ./valgrind-helper.sh my-log.txt my-program
# ./valgrind-helper.sh my-program
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
SEPARATOR="${YELLOW}========================================${NC}"
Introduction
Navigation
Expressions
Text formatting
Notes and comments
Conditionals (if)
Return (return)
Multiple outcome decisions (switch/match)
Traditional switch conditionals (switch)
Goto and jump loops (goto/loop)
#include <set>
#include <utility>
#include <vector>
#include <iostream>
using vpii = std::vector<std::pair<int, int>>;
std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> twos_difference(const std::vector<int, std::allocator<int>> &v)
{
std::set<int, std::less<int>, std::allocator<int>> s = std::set<int, std::less<int>, std::allocator<int>>(v.begin(), v.end());
@ralt
ralt / foo.lisp
Last active June 2, 2024 01:37
Parenscript async/await support
(ps::defprinter ps-js::await (x)
(ps::psw (string-downcase "(await "))
(ps::print-op-argument 'ps-js::await x)
(ps::psw ")"))
(ps::define-trivial-special-ops
await ps-js::await)
(ps::define-statement-operator async-defun (name lambda-list &rest body)
(multiple-value-bind (effective-args body-block docstring)
@CodeByAidan
CodeByAidan / demo.gif
Last active June 2, 2024 01:36
File path not-clickable workaround in Python! Say you have a file path that has a space in a folder, womp womp! Can't click the entire path, but using file:/// with a .as_uri()[8:], it fixes it!
demo.gif
@harryfinn
harryfinn / installing-phpmyadmin-on-subdomain.md
Last active June 2, 2024 01:27
How to install PHPMyAdmin on a subdomain

Installing PHPMyAdmin on a subdomain

I was recently tasked with adding PHPMyAdmin to one of our LAMP servers for a 3rd party with little/no ssh knowledge to use in order to access the MySQL database(s). This gist documents how I configured PHPMyAdmin on the LAMP server on a subdomain with an SSL.

Prerequisites

Before following this guide, it is assumed that you already have a LAMP server up

@tuantmb
tuantmb / breachcompilation.txt
Created December 26, 2017 16:22
1.4 billion password breach compilation wordlist
wordlist created from original 41G stash via:
grep -rohP '(?<=:).*$' | uniq > breachcompilation.txt
Then, compressed with:
7z a breachcompilation.txt.7z breachcompilation.txt
Size:
@tattyd
tattyd / Shadow.cs
Last active June 2, 2024 01:21
Soft shadow control for Unity UI Toolkit
/* MIT License
Copyright (c) 2022 David Tattersall
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@fogonwater
fogonwater / README.md
Last active June 2, 2024 01:16
Countries and continents

I needed to figure out which continent various countries, sovereign states and dependent territories are part of. Shared in case others find it helpful.

  • countries.csv is a flat file of countries and the continent they are part of
  • countries.json is a look-up keyed by 2-digit country code (country_code_2)

Based on United Nations continental regions. The world changes, so names and places may become out of date.